#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,z,a,b;
	y=0,z=0,a=1,b=0;
	scanf("%d",&x);
	while(x!=0)
	{
		y=x%10;
		z=y*2^b+z;
		b=b+1;
		x=x/10;
	}
	cout<<z;

	return 0;
}
